#include <iostream>

struct request
{
    int money;//涨薪数量
};

//抽象经理类
class Manager
{
public:
    Manager(const std::string& name):name(name){}
    virtual void SetManage(Manager *m)
    {
        this->m = m;
    }
    virtual void GetRequest(request *r) = 0;

protected:
    std::string name;
    Manager *m;//直接领导
};

class CommonManager:public Manager//普通经理
{
public:
    using Manager::Manager;
    virtual void GetRequest(request *r)
    {
        if(r->money <= 1000)
        {
            std::cout<<name<<"同意了涨薪"<<std::endl;
        }
        else
        {
            m->GetRequest(r);
        }
    }
};

class Major:public Manager//总监
{
public:
    using Manager::Manager;
    virtual void GetRequest(request *r)
    {
        if(r->money <= 2000)
        {
            std::cout<<name<<"同意了涨薪"<<std::endl;
        }
        else
        {
            m->GetRequest(r);
        }
    }
};

class GeneralManager:public Manager//总经理
{
public:
    using Manager::Manager;
    void GetRequest(request *r)
    {
        std::cout<<name<<"同意了涨薪"<<r->money<<std::endl;
    }
};

int main()
{
    Manager *m1 = new CommonManager("张经理");
    Manager *m2 = new Major("李总监");
    Manager *m3 = new GeneralManager("王总经理");

    m1->SetManage(m2);
    m2->SetManage(m3);

    request r = {3000};
    m1->GetRequest(&r);
    return 0;

}